import { defineConfig } from "vite";
import vue from "@vitejs/plugin-vue";
import path from "path";

// https://vitejs.dev/config/
export default defineConfig({
    plugins: [vue()],
    base: "./",
    resolve: {
        alias: {
            "@": path.resolve(__dirname, "src")
        }
    },
    server: {
        host: "0.0.0.0",
        port: 5566,
        proxy: {
            '/mg': {
                target: 'https://www.step2step.cn', // 目标服务器地址
                changeOrigin: true, // 是否改变请求源
                rewrite: (path) => path.replace(/^\/api/, '') // 重写请求路径
            },
            '/app': {
                target: 'https://www.step2step.cn', // 目标服务器地址
                changeOrigin: true, // 是否改变请求源
                // rewrite: (path) => path.replace(/^\/api/, '') // 重写请求路径
            }
        }
    }
});
